<?php
	if (!isset( $_SESSION)) {
		session_start();
	}
	
	
	if (empty($_SESSION['username'])||($_SESSION['usuario']!='admin')) {
		header('Location: errorNoAdmin.php');
	}
?>
<html>
<head>

	<meta charset="UTF-8">
	<link rel="stylesheet" href="css/estiloregistro.css">
	<link rel="stylesheet" href="css/upload.css">
	<link rel="stylesheet" href="css/estiloheader.css">
	<link rel="stylesheet" href="css/estilosSueltos.css">
	<link rel="stylesheet" href="css/estilopanelcontrol.css">
	<link rel="stylesheet" href="css/estilobody.css">
	<link rel="stylesheet" href="css/estilopie.css">
	<link rel="stylesheet" href="css/alertify.core.css">
	<link rel="stylesheet" href="css/alertify.default.css">
	<link rel="stylesheet" href="css/estilocontacto.css">
	<link rel="stylesheet" href="chosen/chosen.css">
	<script src="js/jquery-2.1.0.js"></script>
	<script type="text/javascript" src="js/validacionesRegistro.js"></script>
	<script type="text/javascript" src="js/validacionesContacto.js"></script>
	<script type="text/javascript" src="js/validacionesUpload.js"></script>
	<script src="js/alertify.js"></script>
	<script	src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
	<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" />
	<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
	<style>
		
			.chosen 
			{
				width: 230px;
			}
		
	</style>
	<script>
		$(document).ready(function(){
		
			var paises = [ "Afganistan","Africa del Sur","Albania","Alemania","Andorra","Angola","Antigua y Barbuda","Antillas Holandesas","Arabia Saudita","Argelia","Argentina","Armenia","Aruba","Australia","Austria","Azerbaijan","Bahamas","Bahrain","Bangladesh","Barbados","Belarusia","Belgica","Belice","Benin","Bermudas","Bolivia","Bosnia","Botswana","Brasil","Brunei Darussulam","Bulgaria","Burkina Faso","Burundi","Butan","Camboya","Camerun","Canada","Cape Verde","Chad","Chile","China","Chipre","Colombia","Comoros","Congo","Corea del Norte","Corea del Sur","Costa de Marfíl","Costa Rica","Croasia","Cuba","Dinamarca","Djibouti","Dominica","Ecuador","Egipto","El Salvador","Emiratos Arabes Unidos","Eritrea","Eslovenia","España","Estados Unidos","Estonia","Etiopia","Fiji","Filipinas","Finlandia","Francia","Gabon","Gambia","Georgia","Ghana","Granada","Grecia","Groenlandia","Guadalupe","Guam","Guatemala","Guayana Francesa","Guerney","Guinea","Guinea-Bissau","Guinea Equatorial","Guyana","Haiti","Holanda","Honduras","Hong Kong","Hungria","India","Indonesia","Irak","Iran","Irlanda","Islandia","Islas Caiman","Islas Faroe","Islas Malvinas","Islas Marshall","Islas Solomon","Islas Virgenes Britanicas","Islas Virgenes (U.S.)","Israel","Italia","Jamaica","Japon","Jersey","Jordania","Kazakhstan","Kenia","Kiribati","Kuwait","Kyrgyzstan","Laos","Latvia","Lesotho","Libano","Liberia","Libia","Liechtenstein","Lituania","Luxemburgo","Macao","Macedonia","Madagascar","Malasia","Malawi","Maldivas","Mali","Malta","Marruecos","Martinica","Mauricio","Mauritania","Mexico","Micronesia","Moldova","Monaco","Mongolia","Mozambique","Myanmar (Burma)","Namibia","Nepal","Nicaragua","Niger","Nigeria","Noruega","Nueva Caledonia","Nueva Zealandia","Oman","Pakistan","Palestina","Panama","Papua Nueva Guinea","Paraguay","Peru","Polinesia Francesa","Polonia","Portugal","Puerto Rico","Qatar","Reino Unido","Republica Centroafricana","Republica Checa","Republica Democratica del Congo","Republica Dominicana","Republica Eslovaca","Reunion","Ruanda","Rumania","Rusia","Sahara","Samoa","San Cristobal-Nevis (St. Kitts)","San Marino","San Vincente y las Granadinas","Santa Helena","Santa Lucia","Santa Sede (Vaticano)","Sao Tome & Principe","Senegal","Seychelles","Sierra Leona","Singapur","Siria","Somalia","Sri Lanka (Ceilan)","Sudan","Suecia","Suiza","Sur Africa","Surinam","Swaziland","Tailandia","Taiwan","Tajikistan","Tanzania","Timor Oriental","Togo","Tokelau","Tonga","Trinidad & Tobago","Tunisia","Turkmenistan","Turquia","Ucrania","Uganda","Uruguay","Uzbekistan","Vanuatu","Venezuela","Vietnam","Yemen","Yugoslavia","Zambia","Zimbabwe" ];

			//Función para hacer la elección de Paises autocompletable.
			$('#paises').autocomplete({
				source: paises
			});

			//Función para mostrar o ocultar el panel de usuario.
			$('#mostrarPanel').on('click',function(){
				$('#cuadro').animate({
					marginLeft:"-7px",
					opacity: "1"
				},
				500,
				function(){
					$('#cuadro').css("background","url(img/pirata.jpg) no-repeat");
				});
			});
			
			$('#ocultarPanel').on('click',function(){
				$('#cuadro').animate({
					marginLeft:"-270px",
					opacity: "0.25"
				},
				500,
				function(){
					$('#cuadro').css("background","grey");
				});
			});
		});
		
		$(document).ready(function(){
			$("#bigImgAlta").mouseover(function(){
				$("#imgPanelControl").css("display","block");
			});
			$("#bigImgAlta").mouseout(function(){
				$("#imgPanelControl").css("display","none");
			});
				  
		// PASS_________________
			$("#bigImgPass").mouseover(function(){
				$("#imgPanelControl2").css("display","block");
			});
			$("#bigImgPass").mouseout(function(){
				$("#imgPanelControl2").css("display","none");
			});
				  
		// SMS_________________
			$("#bigImgAlta3").mouseover(function(){
				$("#imgPanelControl3").css("display","block");
			});
			$("#bigImgAlta3").mouseout(function(){
				$("#imgPanelControl3").css("display","none");
			});
	// CATEGORIA_________________
			$("#bigImgAlta4").mouseover(function(){
				$("#imgPanelControl4").css("display","block");
			});
			$("#bigImgAlta4").mouseout(function(){
				$("#imgPanelControl4").css("display","none");
			});
				  
	// TEMAS_________________
			$("#bigImgAlta5").mouseover(function(){
				$("#imgPanelControl5").css("display","block");
			});
			$("#bigImgAlta5").mouseout(function(){
				$("#imgPanelControl5").css("display","none");
			});
	// TEMAS_________________
			$("#bigImgAlta6").mouseover(function(){
				$("#imgPanelControl6").css("display","block");
			});
			$("#bigImgAlta6").mouseout(function(){
				$("#imgPanelControl6").css("display","none");
			});
		});
	</script>
</head>

<body>
<?php
	require 'js/function.php';
	
	//Condición para saber que tipo de panel mostrar, teniendo 2 opciones: Panel de Login/Registro o Panel de Usuario.
	if (empty($_SESSION['username'])) {
		echo "window.location='errorNoAdmin.php'";
	} else {
?>
	<div id="cuadro">
		<h2 id="bienve">Bienvenido a Light Software</h2>
		<p id="welco">
			<b><button id="mostrarPanel"> </button> <br>W<br>e<br>l<br>c<br>o<br>m<br>e<br></b>
			<button id="ocultarPanel" class="ocultarPanel">Ocultar Panel</button>
		</p>
		<table class="tablalogin">
			<tr>
				<td align="center" width=100><?php echo $_SESSION['username']; ?><br>
					<img src="<?php echo imagenUsuario(); ?>" width="70" height="70" /></td>
	
				<td align="left">
					<a href="panel_control_usuario.php">
						<input type="button" value="Panel Control Usuario" id="botonwelcome"></a><br>
					<a href="uploadSoftware.php">
						<input type="button" value="Subir Programa"	id="botonwelcome"></a><br> 
					<a href="js/cerrarSesion.php">
						<input type="button" value="Cerrar Sesion" id="botonwelcome"></a>
<?php

	//En caso de que el usuario registrado sea un administrador se genera un nuevo botón para administrar el sitio.
	if ($_SESSION['usuario']=='admin') {
		echo "<a href='panel_control.php'><input type='button' value='Administrar Sitio' id='botonwelcome'></a><br>";
	}
?>
									
				</td>
			</tr>
		</table>
	
	</div>
<?php
	}
?>
	<div id="contenedorheader">
		<div id="logo">
			<a href="index.php"><img id="imglogo" src="img/logotipo.png"></a>
		</div>
		<div id="titulo">
			<img src="img/zerologo.png" class="imglogoZero"/>
		</div>
		<div id="menuheader">
			<ul>
				<li id="descargasli"><a href="noticias.php">Noticias</a></li>
				<li id="descargasli"><a href="foro.php">Foros</a></li>
				<li id="descargasli"><a href="contacto.php">Contacto</a></li>
				</ul>
		</div>
		<div class="publigif">
			<img src="img/gif3.gif" class="gifpubli"/>
		</div>
	</div>